//
//  BrandModel.m
//  fitnessmanage
//
//  Created by 众拳科技 on 2017/11/20.
//  Copyright © 2017年 zongquankeji. All rights reserved.
//

#import "BrandModel.h"

#define BrandFilePath [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@brand.data",[[NSUserDefaults standardUserDefaults]objectForKey:@"UserID"]]]

@implementation BrandModel

MJCodingImplementation


+ (NSDictionary *)replacedKeyFromPropertyName{
    return @{
             @"brandID" : @"ID",
             @"brandPic" : @"Logo",             
             @"brandName" : @"Name",
             
             };
}



+ (void)saveBrand:(BrandModel *)brand
{
    // 归档
    [NSKeyedArchiver archiveRootObject:brand toFile:BrandFilePath];
}

+(BrandModel *)brand
{
    // 读取帐号
    BrandModel *brand = [NSKeyedUnarchiver unarchiveObjectWithFile:BrandFilePath];
    
    if (!brand) {
        
        brand = [[BrandModel alloc] init];
    }
    
    return brand;
}

@end
